package Homework.Homework04;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class AddStudent {
    List<Student> list = new ArrayList<>();
    public static void addStudent(List<Student> list) {
        Scanner sc1 = new Scanner(System.in);
        System.out.println("请输入学号");
        int id = sc1.nextInt();
        sc1.nextLine();
        System.out.println("请输入姓名");
        String name = sc1.nextLine();
        System.out.println("请输入年龄");
        Integer age = sc1.nextInt();
        Student student = new Student();
        student.setID(id);
        student.setName(name);
        student.setAge(age);
        list.add(student);
        System.out.println("添加成功！");
    }
}